import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import EventMaintenance from "@/components/worker/EventMaintenance";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Login',
        component: Login
    },
    {
        path: '/admin',
        name: 'Admin',
        component: () => import('../views/Admin.vue')
    },
    {
        path: '/worker/:name',
        name: 'Worker',
        children: [
            {
                path: 'eventMaintenance',
                name: 'EventMaintenance',
                component: EventMaintenance,
            },
            {
                path: 'supplyMaintenance',
                name: 'SupplyMaintenance',
                component: () => import("../components/worker/SupplyMaintenance.vue")
            },
            {
                path: 'locationMaintenance',
                name: 'LocationMaintenance',
                component: () => import("../components/worker/LocationMaintenance.vue")
            },
            {
                path: 'enterpriseMaintenance',
                name: 'EnterpriseMaintenance',
                component: () => import("../components/worker/EnterpriseMaintenance.vue")
            },
            {
                path: 'processMaintenance',
                name: 'ProcessMaintenance',
                component: () => import("../components/worker/ProcessMaintenance.vue")
            },
            {
                path: 'cityMaintenance',
                name: 'CityMaintenance',
                component: () => import("../components/worker/CityMaintenance.vue")
            },
            {
                path: 'reportMaintenance',
                name: 'ReportMaintenance',
                component: () => import("../components/worker/ReportMaintenance.vue")
            }
        ],
        component: () => import('../views/Worker'),
    },
    {
        path: '/commander/:name',
        name: 'Commander',
        children: [
            {
                path: 'emergencyManagement',
                name: 'EmergencyManagement',
                component: () => import('../components/commander/EmergencyManagement')
            },
            {
                path: 'reportManagement',
                name: 'ReportManagement',
                component: () => import('../components/commander/ReportManagement')
            }
        ],
        component: () => import('../views/Commander')
    },
    {
        path: '/expert/:name',
        name: 'Expert',
        children: [
            {
                path: 'reportCheck',
                name: 'ReportCheck',
                component: () => import('../components/expert/ReportCheck')
            }
        ],
        component: () => import('../views/Expert')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
